Skip to content

Localize Tutorial Tool and forward locale to embedded editors - #11626

Open
Christian BR (ChrisesDK) wants to merge 4 commits into
microsoft:masterfrom
ChrisesDK:tutorial-tool-localization-pr
Open

Christian BR (ChrisesDK) wants to merge 4 commits into
microsoft:masterfrom
ChrisesDK:tutorial-tool-localization-pr

Conversation

@ChrisesDK

Copy link
Copy Markdown

Summary

Adds generic localization support to the current React-based MakeCode Tutorial Tool and forwards the active locale to embedded MakeCode editors.

Changes

  • initializes Tutorial Tool localization using the existing PXT localization runtime
  • adds Tutorial Tool strings to the normal PXT localization extraction and publication pipeline
  • adds TranslationsKind.TutorialTool runtime support
  • localizes 9 user-facing React Tutorial Tool strings
  • forwards lang / forcelang to embedded MakeCode editors while preserving existing locale parameters
  • adds locale forwarding support to the legacy Tutorial Tool iframe path without claiming to localize the legacy shell
  • adds focused tests for locale forwarding, default-English behavior, extraction, and runtime catalog loading

Validation

  • gulp tutorialtoolTest - 11 passing
  • Tutorial Tool extraction - 36 files scanned, 9 keys extracted
  • gulp pxtlib - passed
  • gulp testpxteditor - 66 passing
  • git diff --check - passed

The full React build was not run locally because the local Tutorial Tool dependency installation does not contain react-app-rewired. The standalone Tutorial Tool typecheck is also blocked by the existing pxtarget.d.ts types configuration issue; neither issue is introduced by this patch.

Scope

This PR is generic and does not contain Danish-specific translations.

Out of scope:

@ChrisesDK
Christian BR (ChrisesDK) force-pushed the tutorial-tool-localization-pr branch 3 times, most recently from 56dc276 to a9fac7d Compare October 26, 2026 10:31
@ChrisesDK
Christian BR (ChrisesDK) force-pushed the tutorial-tool-localization-pr branch from a9fac7d to 2d01cf3 Compare October 28, 2026 09:00
@ChrisesDK

Copy link
Copy Markdown
Author

Rebased onto current master and confirmed the PR is mergeable again.

Joey Wunderlich (@jwunderl), could you please review the Tutorial Tool localization and embedded-editor locale-forwarding approach when you have capacity? The URL handling intentionally preserves an editor's explicit lang/forcelang, forwards an explicit host setting, and leaves the default English URL unchanged; the focused tests cover those cases.

The new fork-PR Actions runs are currently at GitHub's action_required approval gate, so a maintainer approval/run would let the normal validation proceed. Happy to adjust the implementation or split follow-up work if preferred.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved locale-forwarding bugs can ignore explicit language selections or override saved editor preferences, while an unnecessary API-catalog download delays startup for non-English users.

4 open issues
What changed in this PR

Adds localization support to the React Tutorial Tool using PXT’s existing translation infrastructure and forwards locale requests to embedded MakeCode editors.

Changes:

  • Initializes localization before rendering and localizes document metadata and iframe labels.
  • Extends translation catalog loading, publication, and extraction tasks for the Tutorial Tool.
  • Adds locale-aware iframe URL helpers and focused regression tests.
File Description
tutorialtool/​tests/​tsconfig.json Configures the focused TypeScript tests.
tutorialtool/​tests/​localizationExtraction.spec.ts Checks extraction configuration and expected translation keys.
tutorialtool/​tests/​legacyIframeUrl.spec.ts Tests locale forwarding through the legacy helper.
tutorialtool/​tests/​iframeUrl.spec.ts Tests locale forwarding and preservation of URL parameters.
tutorialtool/​src/​utils/​localization.ts Selects the locale, initializes translations, and localizes metadata.
tutorialtool/​src/​utils/​iframeUrl.ts Adds locale parsing and editor URL construction helpers.
tutorialtool/​src/​index.tsx Initializes localization before analytics and rendering.
tutorialtool/​src/​components/​MakeCodeFrame.tsx Uses locale-aware URLs and adds a localized iframe title.
tests/​pxt-editor-test/​editorrunner.ts Tests Tutorial Tool runtime catalog loading.
pxtlib/​util.ts Adds Tutorial Tool translation-kind support.
gulpfile.js Adds extraction and test tasks to the build workflow.
docs/​static/​tutorial-tool/​tutorial.ts Adds locale forwarding to the legacy iframe source.
cli/​crowdin.ts Includes Tutorial Tool catalogs in translation publication.

Review effort: Max

Comment thread docs/static/tutorial-tool/tutorial.ts Resolved
Comment thread docs/static/tutorial-tool/tutorial.ts Resolved
Comment thread pxtlib/util.ts Resolved
Comment thread tutorialtool/src/utils/iframeUrl.ts Resolved
@ChrisesDK
Christian BR (ChrisesDK) force-pushed the tutorial-tool-localization-pr branch from 2d01cf3 to 119ca93 Compare October 30, 2026 23:26
@ChrisesDK

Christian BR (ChrisesDK) commented Oct 30, 2026 •

Copy link
Copy Markdown
Author

Rebased onto current master and addressed the four locale-forwarding review findings:

  • updated the actually served legacy tutorial.js, while retaining its existing endpoint list;
  • legacy embeds now forward only explicit host lang/forcelang;
  • explicit English selections are preserved for the embedded editor;
  • Tutorial Tool skips the unused API catalog request during startup.

Added regression coverage for explicit English and the legacy fallback behavior. Validation passes: 17/17 Tutorial Tool tests and 93/93 PXT editor tests.

Joey Wunderlich (@jwunderl), these fixes landed after the earlier approval; all four threads are resolved and the branch is ready for a fresh review when convenient.

@ChrisesDK

Copy link
Copy Markdown
Author

Rebased onto current master (19bd210). Current TypeScript requires the Tutorial Tool's no-API-catalog path to return an explicit resolved promise; that small compatibility fix is included.

Fresh validation passes:

  • npm run build -- --no-webapps
  • 17/17 Tutorial Tool tests
  • 105/105 PXT editor tests

Joey Wunderlich (@jwunderl), the branch is mergeable again and ready for a fresh review when convenient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants